package com.bizzan.bitrade.listenConfig;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * Project Name: 00_framework
 * Package Name: com.bizzan.bitrade.listenConfig
 * Description :
 * 测试地址：  http://localhost:7000/test
 * 返回：Hello, aaa! I'm from service-provider.
 * @author : xinyanfei
 * @date : 2025/10/22 12:52
 * Copyright (c) 2025, 京东商城  All Rights Reserved.
 */

@RestController
public class ConsumerNacosService {
    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/test")
    public String callOtherService() {
        // 使用服务名（例如：service-provider）代替主机名和端口
        String response = restTemplate.getForObject("http://cloud-service/hello/aaa", String.class);
        System.out.println("response = " + response);
        return response;
    }
}
